package com.itany.corejava.code08_常用类.练习7;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月16日 17:14
 */

/**
 * 定义一个地址的泛型类:有2个未知的类型
 * 有省份名称
 * 有城市名称
 * 有城市的详情（未知类型）
 * 有城市的小吃（未知的类型）
 *
 *
 * 定义一个详情类
 * 有城市的介绍
 *
 * 定义一个食物类
 * 有小吃的名称、口感
 *
 * 新建一个Test类
 * 然后在main方法中去给地址类的详情设置为详情的实例
 * 给地质类的小吃设置为食物类的实例
 *
 */
public class Address<T,K>{
    private String province;
    private String city;
    private T detail;
    private K food;

    public Address() {
    }

    public Address(String province, String city, T detail, K food) {
        this.province = province;
        this.city = city;
        this.detail = detail;
        this.food = food;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public T getDetail() {
        return detail;
    }

    public void setDetail(T detail) {
        this.detail = detail;
    }

    public K getFood() {
        return food;
    }

    public void setFood(K food) {
        this.food = food;
    }

    @Override
    public String toString() {
        return "Address{" +
                "province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", detail=" + detail +
                ", food=" + food +
                '}';
    }
}
class Details{
    private String introduce;

    public Details(String introduce) {
        this.introduce = introduce;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    @Override
    public String toString() {
        return "Details{" +
                "introduce='" + introduce + '\'' +
                '}';
    }
}
class Foods{
    private String fooName;
    private String taste;

    public Foods(String fooName, String taste) {
        this.fooName = fooName;
        this.taste = taste;
    }

    public String getFooName() {
        return fooName;
    }

    public void setFooName(String fooName) {
        this.fooName = fooName;
    }

    public String getTaste() {
        return taste;
    }

    public void setTaste(String taste) {
        this.taste = taste;
    }

    @Override
    public String toString() {
        return "Foods{" +
                "fooName='" + fooName + '\'' +
                ", taste='" + taste + '\'' +
                '}';
    }
}